package com.py.credit.utils;
import java.io.File;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;

import net.glxn.qrgen.core.image.ImageType;
import net.glxn.qrgen.javase.QRCode;

public class QRcodeUtil {

	public static void writeToStream(String url, int width, int height, OutputStream os) {

		QRCode.from(url).to(ImageType.PNG).withSize(width, height).writeTo(os);

	}
	
	public static File writeToFile(String url, int width, int height) throws UnsupportedEncodingException {
		url = new String(url.getBytes("UTF-8"),"ISO-8859-1");
		return QRCode.from(url).to(ImageType.PNG).withSize(width, height).file();

	}
}
